﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="Discussion_Test" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Test</title>
    <link href="../Styles/metro.blue.css" rel="stylesheet" type="text/css" />
    <link href="../Styles/Hazem.css" rel="stylesheet" type="text/css" />
    <script src="../Scripts/jquery-1.6.4.min.js" type="text/javascript"></script>
    <script src="../Scripts/jquery.signalR-0.5.2.min.js" type="text/javascript"></script>
    <script type="text/javascript" src='<%= ResolveClientUrl("~/signalr/hubs") %>'></script>
    <script type="text/javascript">
        $(function () {
            var conChat = $.connection.discussion_handler;
            conChat.addDiscussionThread = function (date, message, name) {
                var newComment = $('#Discussion').html()
                +'<div class="hazemDiscussionThreadContainer bluebg white">'
                + '<div id="baloonDiv" class="hazemDiscussionThreadBaloonThingiSent"/>' 
                +        '<div id="textDiv" class="hazemDiscussionThreadText white">' 
                +            '<label id="text" Text=' + message + '></label>' 
                +        '</div>' 
                +        '<div id="dateDiv" class="hazemDiscussionThreadDate white">' 
                +            '<label ID="date" Text=' + date + '></label>' 
                +        '</div>' 
                +        '<label ID="memberID" Text=' + name + '></label>' 
                +    '</div>';


                $('#Discussion').html(newComment);
            };
            $("#btnSubmit").click(function () {
                //conChat.newDiscussionThread($('#comment').val(), 1, $('#username').text());
                          //(String msg, int discussionID, int memberID) // get them from the session somehow :S
                conChat.neww($('#comment').val(), 1, $('#username').text());
                 $('#comment').val('');
            });
            $.connection.hub.start();
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div id="header" class="hazemHeader">
        <h3 id="username" runat="server" style="text-transform: none; float: right; margin-right: 10px; padding-bottom:10px">Hi</h3>
    </div>
    <br />
    <div class="hazemBody">
        <h1 class="accent">
            &lt;Discussion name&gt;
        </h1>
        <br />
        
        <br />
        <div id="Discussion" style=" width:50%">
    <!--        <div class="hazemDiscussionThreadContainer bluebg white" >
                <div style=" height:50px; width:100% ;background-color:#393; float:left">2</div>
                <div style=" height:50px; width:50px;background-color:#923; float:right">2</div>
                   <div class="hazemDiscussionThreadBaloonThingiSent">
                    </div>
                    <div class="hazemDiscussionThreadText white">
                        <span>hellohellohellohellohellohe ellohello</span>
                    </div>
                    <div class="hazemDiscussionThreadDate white">
                        10:30 PM
                    </div>
                    </div>

            
            </div>
    -->
            <asp:Repeater runat="server" ID="DiscussionThreads" OnItemDataBound="OnItemDataBoundFun">
                <HeaderTemplate>
                </HeaderTemplate>
                <ItemTemplate>

                    <div runat="server" id="containerDiv" class="hazemDiscussionThreadContainer">
                        <div runat="server" id="baloonDiv">
                        </div>
                        <div runat="server" id="textDiv" class="hazemDiscussionThreadText">
                            <asp:Label ID="text" runat="server" Text='<%# Bind("Text") %>'></asp:Label>
                        </div>
                        <div runat="server" id="dateDiv" class="hazemDiscussionThreadDate">
                            <asp:Label ID="date" runat="server" Text='<%# Bind("TimeStamp") %>'></asp:Label>
                        </div>
                        <asp:Label ID="memberID" runat="server" Text='<%# Bind("MemberID") %>'></asp:Label>
                    </div>

                </ItemTemplate>
                <FooterTemplate>
                </FooterTemplate>
            </asp:Repeater>
        </div>
        <textarea id="comment" style="width:100%; margin-bottom:10px"></textarea>
        <input id="btnSubmit" type="button" class="hazemButton" value="Submit"/>

    </div>
    </form>
</body>
</html>


<!-- 

        <div class="hazemDiscussionThreadContainer bluebg white">
            <div class="hazemDiscussionThreadBaloonThingiSent">
            </div>
            <div class="hazemDiscussionThreadText white">
                <span>hellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohe
                    llohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohelloh
                    ellohello</span>
            </div>
            <div class="hazemDiscussionThreadDate white">
                10:30 PM
            </div>
        </div>
        <div class="hazemDiscussionThreadContainer graybg ">
            <div class="hazemDiscussionThreadBaloonThingiRecieved">
            </div>
            <div class="hazemDiscussionThreadText">
                <span>hellohellohellohellohellohe ellohello</span>
            </div>
            <div class="hazemDiscussionThreadDate">
                10:30 PM
            </div>
        </div>
        <div class="hazemDiscussionThreadContainer bluebg white">
            <div class="hazemDiscussionThreadBaloonThingiSent">
            </div>
            <div class="hazemDiscussionThreadText white">
                <span>hellohellohellohellohellohe ellohello</span>
            </div>
            <div class="hazemDiscussionThreadDate white">
                10:30 PM
            </div>
        </div>
-->